Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

statistics: improve estimation for index equal con ... (#17366) #17611

Merged
merged 3 commits into from
Jun 3, 2020

Conversation

sre-bot
Copy link
Contributor

@sre-bot sre-bot commented Jun 3, 2020

cherry-pick #17366 to release-4.0


What problem does this PR solve?

Issue Number: close #17364

Problem Summary:

Wrong plan is chosen when index equal condition contains value which is out of the range of the histogram.

What is changed and how it works?

What's Changed:

Compute the NDV for the prefix columns of the index which are used for equal condition, and use it for row count guess.

How it Works:

It is more reasonable than hard-coded constant outOfRangeBetweenRate.

Related changes

N/A

Check List

Tests

  • Unit test

Side effects

N/A

Release note

  • improve row count estimation for index equal condition

Signed-off-by: sre-bot <sre-bot@pingcap.com>
@sre-bot
Copy link
Contributor Author

sre-bot commented Jun 3, 2020

/run-all-tests

Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zz-jason zz-jason linked an issue Jun 3, 2020 that may be closed by this pull request
Copy link
Contributor

@lzmhhh123 lzmhhh123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lzmhhh123 lzmhhh123 added the status/LGT2 Indicates that a PR has LGTM 2. label Jun 3, 2020
@eurekaka eurekaka added the status/can-merge Indicates a PR has been approved by a committer. label Jun 3, 2020
@sre-bot
Copy link
Contributor Author

sre-bot commented Jun 3, 2020

/run-all-tests

@eurekaka
Copy link
Contributor

eurekaka commented Jun 3, 2020

/run-integration-copr-test

@sre-bot
Copy link
Contributor Author

sre-bot commented Jun 3, 2020

@sre-bot merge failed.

@eurekaka
Copy link
Contributor

eurekaka commented Jun 3, 2020

/run-integration-copr-test

@eurekaka
Copy link
Contributor

eurekaka commented Jun 3, 2020

/run-integration-br-test

@zz-jason zz-jason changed the title statistics: improve estimation for index equal condition (#17366) statistics: improve estimation for index equal con ... (#17366) Jun 3, 2020
@zz-jason zz-jason merged commit 90d9908 into pingcap:release-4.0 Jun 3, 2020
@bb7133 bb7133 modified the milestones: v4.0.1, v4.0.2 Jun 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/statistics sig/planner SIG: Planner status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/enhancement The issue or PR belongs to an enhancement. type/4.0-cherry-pick
Projects
None yet
Development

Successfully merging this pull request may close these issues.

improve row count estimation for index equal condition
5 participants